import jsonschema
json_data = {
    "success": False,
    "code": 10000,
    "message": "xxx登录成功",
    "data": {
        "name": "Lily",
        "age": 20
    },
}
schema = {
    "type": "object",
    "properties": {
        "success": {"type": "boolean"},
        "code": {"type": "integer"},
        "message": {"pattern": "xxx登录成功$"},
        "data": {
            "type": "object",
            "properties": {
                "name": {"const": "Lily"},
                "age": {"const": 20}
            },
            "required": ["name", "age",]
        }
    },
    "required": ["success", "code", "message", "data"]
}
res = jsonschema.validate(instance=json_data, schema=schema)
print("校验结果：", res)
